package com.design.yjx.command.remote;

import com.design.yjx.command.common.Command;
import com.design.yjx.command.common.Fan;
import com.design.yjx.command.common.FanHighCommand;
import com.design.yjx.command.common.FanLowCommand;
import com.design.yjx.command.common.FanMidCommand;
import com.design.yjx.command.common.FanOffCommand2;

/**
 * @author yuanjianxin
 * @date 2017/8/21 14:24
 */
public class Main2 {
    public static void main(String[] args) {
        RemoteControl control = new RemoteControl();

        //电扇命令
        Fan fan = new Fan();
        Command high = new FanHighCommand(fan);
        Command mid = new FanMidCommand(fan);
        Command low = new FanLowCommand(fan);
        Command off = new FanOffCommand2(fan);


        control.setCommand(1,high,off);
        control.setCommand(2,mid,off);
        control.setCommand(3,low,off);


        control.onButtonWasPushed(1);
        System.out.println(fan);

        control.onButtonWasPushed(2);
        System.out.println(fan);

        control.undoButtonWasPushed();
        System.out.println(fan);

        control.onButtonWasPushed(3);
        System.out.println(fan);

        control.offButtonWasPushed(3);
        System.out.println(fan);

        control.undoButtonWasPushed();
        System.out.println(fan);



    }
}
